<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="lt-ie7"> <![endif]-->
<!--[if IE 8]>         <html class="lt-ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<?php

$str= $_GET['str'];
if (!isset ($_COOKIE[ini_get('name')])) {
    session_set_cookie_params(0, '/');
    session_name('name');
    session_start();
}
include_once 'Connectors/CommonWSSearch.php';
$ws=new SearchWS();


$result=$ws->GeneralSearch($str,$_SESSION['session_mail']);

?>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Sports Around</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />




    <script>
        $(document).ready(function(e) {
            setTimeout(function(){
                $('.cBox .mainTitleBox').each(function(index, element) {
                    var widthTitle = $(this).find('.tit').outerWidth(true);
                    var pWidth = $(this).parent().width();
                    $(this).find('.decor').width(Math.floor((pWidth-widthTitle)/2));
                });
                $('.cBox .amigosSolic').jScrollPane();
            },400);
            $('.verAmigCom').click(function(e) {
                e.preventDefault();
                var t = $(this).text();
                $(this).text(t=='Ver' ? "Cerrar" : "Ver")
                $(this).parents('.amigItem').find('.amigosComun').toggle();
                $('.cBox .amigosSolic').jScrollPane();
            });
        });
    </script>


</head>
<body>
<div class="cBox">
    <div class="mainTitleBox">
        <div class="decor"></div>
        <div class="tit">RESULTS </div>
        <div class="decor"></div>
    </div>


    <div class="amigosSolic">
        <?php
        foreach($result->body as $temp)
        {
            ?>
        <div class="amigItem clearfix">
        <img src="img/perfil/imgThumb.jpg" width="40" height="40">
        <div class="nom"><a href="perfil.php" class="standLinkText"><?php echo $temp->name; ?></a><br><span><?php echo $temp->friends_in_common_int; ?> friends in common <?php
            if($temp->friends_in_common_int>0)
            {
           echo '-<a href="#" class="verAmigCom">Ver</a>';
            }
            ?>
         </span></div>

        <div class="clear"></div>
        <div class="amigosComun clearfix">
        <h2>Friends in common</h2>
            <?php



            foreach($temp->friends_in_common as $fic)
            {
?>
        <div class="amigComItem">
        <img src="img/perfil/imgThumb2.jpg" width="30" height="30">
        <div class="nomCom"><a href="perfilJugadorPublico.php"><?php echo $fic->name ?></a></div>
        </div>


                <?php
            }
            echo '</div>';
        echo '</div>';
        }

    ?>
    </div>



</div>

</body>
</html>
